
import React, { useState } from "react";



export default function Home() {
  return (
    <main>
      <h1 className="text-3xl font-bold underline">
        发送
      </h1>
    </main>
  );
}

export declare interface AppBetterProps {
  children: React.ReactNode; // 一般情况下推荐使用，支持所有类型
  functionChildren: (name: string) => React.ReactNode;
  style?: React.CSSProperties; // 传递style对象
  iptChange?: React.ChangeEventHandler<HTMLInputElement>;
  onChange?: React.FormEventHandler<HTMLInputElement>; // form表单事件, 泛型参数是event.target的类型
}

// 通过 interface 对 event 对象进行类型声明编写的话又十分浪费时间，幸运的是 React 的声明文件提供了 Event 对象的类型声明。

// ClipboardEvent<T = Element> 剪切板事件对象
// DragEvent<T =Element> 拖拽事件对象
// ChangeEvent<T = Element> Change 事件对象
// KeyboardEvent<T = Element> 键盘事件对象
// MouseEvent<T = Element> 鼠标事件对象
// TouchEvent<T = Element> 触摸事件对象
// WheelEvent<T = Element> 滚轮时间对象
// AnimationEvent<T = Element> 动画事件对象
// TransitionEvent<T = Element> 过渡事件对象

type EventHandler<E extends React.SyntheticEvent<any>> = {
  bivarianceHack(event: E): void;
}["bivarianceHack"];
type ReactEventHandler<T = Element> = EventHandler<React.SyntheticEvent<T>>;
// 剪切板事件
type ClipboardEventHandler<T = Element> = EventHandler<React.ClipboardEvent<T>>;
// 拖拽事件
type DragEventHandler<T = Element> = EventHandler<React.DragEvent<T>>;
// 鼠标聚焦事件
type FocusEventHandler<T = Element> = EventHandler<React.FocusEvent<T>>;
// 表单事件
type FormEventHandler<T = Element> = EventHandler<React.FormEvent<T>>;
// 值改变事件
type ChangeEventHandler<T = Element> = EventHandler<React.ChangeEvent<T>>;
// 键盘事件
type KeyboardEventHandler<T = Element> = EventHandler<React.KeyboardEvent<T>>;
// 鼠标事件
type MouseEventHandler<T = Element> = EventHandler<React.MouseEvent<T>>;
// 触摸事件
type TouchEventHandler<T = Element> = EventHandler<React.TouchEvent<T>>;
// 指针事件
type PointerEventHandler<T = Element> = EventHandler<React.PointerEvent<T>>;
// UI事件
type UIEventHandler<T = Element> = EventHandler<React.UIEvent<T>>;
// 滚轮时间对象
type WheelEventHandler<T = Element> = EventHandler<React.WheelEvent<T>>;
// 动画事件
type AnimationEventHandler<T = Element> = EventHandler<React.AnimationEvent<T>>;
// 过渡动画事件
type TransitionEventHandler<T = Element> = EventHandler<
  React.TransitionEvent<T>
>;


// type Result = ['p0', 'p1']
type ResultField<Count extends number, Result extends string[] = []> = Result['length'] extends Count ? Result[number] : ResultField<Count, [...Result, `p${Result['length']}`]>
type GenerateObject<Count extends number> = {
  [key in ResultField<Count>]: string;
}

type MyObject = Omit<GenerateObject<5>, 'p0'> & {
  id: number
}

const a: MyObject = {
  id: 1,
  p1: '1',
  p2: '2',
  p3: '3',
  p4: '4'
}


interface ComplexObject {
  age: number;
  name?: string;
  hobby?: string;
}

type GetOptional<T> = {
  // [P in keyof T as `get${P&string}`]: T[P]
  [P in keyof T as T[P] extends Required<T>[P] ? never : P]: T[P]
}
type Prettify<T> = {
  [k in keyof T]: T[k];
};
type ceshi = Prettify<GetOptional<ComplexObject>>
let kesy: ceshi

// console.log(kesy.);





